//
//  BiometricUtil.swift
//  AirlineReservation
//
//  Created by Kevin on 2020/1/31.
//  Copyright © 2020 Kevin. All rights reserved.
//

import UIKit
import LocalAuthentication

class BiometricUtil: NSObject {
    
    static let shareInstance:BiometricUtil = {
        return BiometricUtil()
    }()
    
    // MARK: 检测设备支持类型,0:不支持；1：指纹；2:人脸
    func checkSupport() -> Int {
        let ctx = LAContext()
        let error:NSErrorPointer = nil
        let isOk = ctx.canEvaluatePolicy(.deviceOwnerAuthentication, error: error)
        if error != nil {
            return 0
        }
        if !isOk {
            return 0
        }
        return ctx.biometryType.rawValue
    }
    
    
}
